# import matplotlib.pyplot as plt
# import pandas as pd
# df = pd.read_excel('产品销售表.xlsx',sheet_name=['第1分店','第2分店','第3分店'])
# df_list=[]
# df_list.append(df['第1分店'])
# df_list.append(df['第2分店'])
# df_list.append(df['第3分店'])
# width=0.3
# for i in range(len(df_list)):
#     df_temp=df_list[i]
#     df_temp.dropna(axis=0,subset=['数量'],inplace=True)
#     df_temp.drop_duplicates(inplace=True)
#     df_temp=df_temp.groupby('季度').agg('sum')
#     x=df_temp.index
#     height=df_temp.index
#     height=df_temp['销售额（万元）']
#     plt.bar(x + width * i, height, width)
# plt.rcParams['font.sans-serif']='SimHei'
# plt.ylabel('销售额/万元')
# plt.legend(['第一分店','第二分店','第三分店'])
# plt.xticks([1,2,3,4],['第1季度','第2季度','第3季度','第4季度'])
# plt.title('每个季度不同分店销售额柱状图')
# plt.show()
# import matplotlib.pyplot as plt
# import pandas as pd
# df=pd.read_excel('图书各地区销售表.xlsx',index_col=0)
# data=df.agg('sum')
# plt.pie(data,labels=df.columns,autopct='%.2f%%')
# plt.rcParams['font.sans-serif']='SimHei'
# plt.title('各地区图书销售额饼状图')
# plt.show()
# import matplotlib.pyplot as plt
# import pandas as pd
# df=pd.read_excel('营销和产品销量表.xlsx',index_col=0)
# plt.rcParams['font.sans-serif']='SimHei'
# plt.rcParams['figure.figsize']=(8,5)
# x=df['展现量']
# y1=df['点击量']
# plt.subplot(2,2,1)
# plt.scatter(x,y1)
# plt.legend(('展现量与点击量',),loc='lower right')
# y2=df['订单金额']
# plt.subplot(2,2,2)
# plt.scatter(x,y2,s=20,c='r',marker='*')
# plt.legend(('展现量与订单金额',),loc='lower right')
# y3=df['加购数']
# plt.subplot(2,2,3)
# plt.scatter(x,y3,s=25,c='g',marker='d')
# plt.legend(('展现量与加购数',),loc='lower right')
# y4=df['下单新客数']
# plt.subplot(2,2,4)
# plt.scatter(x,y4,s=30,c='b',marker='+')
# plt.legend(('展现量与下单新客数',),loc='lower right')
# plt.show()
import matplotlib.pyplot as plt
import pandas as pd
df =pd.read_excel('超市销售信息表.xlsx')
plt.boxplot(df['购物体验评分'],positions=[1])
plt.boxplot(df['购物体验评分'],positions=[2],notch=True,whis=0.5,patch_artist=True,boxprops={'facecolor':'r'},showmeans=True)
Q1=df['购物体验评分'].describe()['75%']
Q2=df['购物体验评分'].describe()['25%']
up_limit=Q1+(Q1-Q2)*0.5
low_limit=Q2-(Q1-Q2)*0.5
val=df['购物体验评分'][(df['购物体验评分']>up_limit)|(df['购物体验评分']<low_limit)]
print('购物体验评分的统计值:\n',df['购物体验评分'].describe())
print('whis为0.5时异常值:\n',val)
plt.show()